package com.ncui.wisdomLearn.api.dto;

import com.ncui.wisdomLearn.api.valid.UserValidGroups;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;

/**
 * 用户 DTO
 *
 * @author lvlele
 * @since 2025-01-03
 */
@Data
public class UserDTO implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 用户id
     */
    @NotNull(message = "用户ID不能为空", groups = { UserValidGroups.Update.class })
    private Long userId;

    /**
     * 用户名称
     */
    @NotBlank(message = "用户名不能为空", groups = { UserValidGroups.Add.class })
    private String username;

    /**
     * 用户昵称
     */
    private String nikeName;

    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空", groups = { UserValidGroups.Add.class })
    private String password;


    /**
     * 手机号
     */
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
    private String phone;

    /**
     * 邮箱
     */
    @NotBlank(message = "邮箱不能为空", groups = { UserValidGroups.Add.class })
    @Email(message = "邮箱格式不正确")
    private String email;

    /**
     * 启用状态：0:正常 9:禁用
     */
    private Integer status;
} 